
import {IPackNifi} from "../inter"
import InvalidUrl from "../svg/warn-triangle-filled.svg?url";
import RunningUrl from "../svg/clock.svg?url";
import StoppedUrl from "../svg/stop-fill.svg?url";
import DisabledUrl from "../svg/disabled.svg?url";
import ValidatingUrl from "../svg/pulse-rings-multiple.svg?url"

// 连接桩数据
const PORT_ATTRS: any = {
    circle: {
        magnet: true,
        stroke: '#8f8f8f',
        r: 5,
    },
}
export const DEFAULT_PORTS_GROUPS: any = {
    left: { position: 'left', attrs: PORT_ATTRS },
    top: { position: "top", attrs: PORT_ATTRS },
    bottom: { position: 'bottom', attrs: PORT_ATTRS },
    right: { position: 'right', attrs: PORT_ATTRS },
    "arrow-left": {
        position: { name: 'left' },
        markup: [
            {
                tagName: 'path',
                selector: 'path',
            },
        ],
        attrs: {
            path: {
                d: 'M -4 4 L -4 -4 L 0 0 Z',
                magnet: true,
                stroke: '#31d0c6',
                fill: '#fff',
                strokeWidth: 2,
            },
        },
    }
}

export const DEFAULT_NODE_PORTS = {
    groups: DEFAULT_PORTS_GROUPS,
    items:[{id:"in",group:"left"},{id:"out",group:"right"}]
}

export const DEFAULT_STATUS_NAME:Record<string,{cn:string,en:IPackNifi.NIFI_CELL_STATUS}> = {
    "Disabled":{cn:"禁用",en:"Disabled"},
    "Invalid":{cn:"无效",en:"Invalid"},
    "Running":{cn:"运行中",en:"Running"},
    "Stopped":{cn:"停止",en:"Stopped"},
    "Validating":{cn:"校验中",en:"Validating"},
}

export const DEFAULT_EDGE_LINE_STYLE:Record<IPackNifi.NIFI_CELL_STATUS,any> = {
    "Disabled":{style:{},strokeDasharray:0},
    "Invalid":{style:{},strokeDasharray:0},
    "RUN":{style:{},strokeDasharray:0},
    "Running":{style:{animation: 'ant-line 30s infinite linear'},strokeDasharray:5},
    "Stopped":{style:{},strokeDasharray:0},
    "Validating":{style:{animation: 'ant-line-reverse 30s infinite linear'},strokeDasharray:5},
}

export const DEFAULT_STATUS_COLOR:Record<any,string> = {
    "Disabled":"#909399",
    "Invalid":"#E6A23C",
    "RUN":"#67C23A",
    "Running":"#67C23A",
    "Stopped":"#409EFF",
    "Validating":"#FF9933",
}

export const DEFAULT_STATUS_ICON:Record<string,string> = {
    "Disabled":DisabledUrl,
    "Invalid":InvalidUrl,
    "Running":RunningUrl,
    "Stopped":StoppedUrl,
    "Validating":ValidatingUrl,
}



export const DEFAULT_CELL_NAME:Record<IPackNifi.NIFI_CAMEL_NAME|IPackNifi.NIFI_CELL_NAME,{type:string,cn:string,en:IPackNifi.NIFI_CELL_NAME,name:IPackNifi.NIFI_CAMEL_NAME}> = {
    processors:{type:"PROCESSOR",cn:"算子",en:"processors",name:"processors"},
    processGroups:{type:"PROCESS_GROUP",cn:"处理组",en:"process-groups",name:"processGroups"},
    "process-groups":{type:"PROCESS_GROUP",cn:"处理组",en:"process-groups",name:"processGroups"},
    inputPorts:{type:"INPUT_PORT",cn:"输入端口",en:"input-ports",name:"inputPorts"},
    "input-ports":{type:"INPUT_PORT",cn:"输入端口",en:"input-ports",name:"inputPorts"},
    outputPorts:{type:"OUTPUT_PORT",cn:"输出端口",en:"output-ports",name:"outputPorts"},
    "output-ports":{type:"OUTPUT_PORT",cn:"输出端口",en:"output-ports",name:"outputPorts"},
    labels:{type:"LABEL",cn:"标签",en:"labels",name:"labels"},
    funnels:{type:"FUNNEL",cn:"漏斗",en:"funnels",name:"funnels"},
    connections:{type:"CONNECTION",cn:"连线",en:"connections",name:"connections"},
    templates:{type:"TEMPLATE",cn:"模板",en:"templates",name:"templates"},
    remoteProcessGroups:{type:"REMOTE_PROCESS_GROUP",cn:"远程处理组",en:"remote-process-groups",name:"remoteProcessGroups"},
    "remote-process-groups":{type:"REMOTE_PROCESS_GROUP",cn:"远程处理组",en:"remote-process-groups",name:"remoteProcessGroups"},
}



// 更新节点数据和状态  
export const upCellName = (name:IPackNifi.NIFI_CELL_NAME= "processors") => {}
export const upCellLabel = () => {}
//
export const upNodeStatus = (status:IPackNifi.NIFI_CELL_STATUS) => {}

//
export const upCell = () => {}